Skip to content

feat: Add OpenAPI documentation on controller OAuth2ProviderController web routes#113

Open
matiasperrone-exo wants to merge 2 commits intomainfrom
feat/openapi----web---oauth2providercontroller
Open

feat: Add OpenAPI documentation on controller OAuth2ProviderController web routes#113
matiasperrone-exo wants to merge 2 commits intomainfrom
feat/openapi----web---oauth2providercontroller

Conversation

@matiasperrone-exo
Copy link
Copy Markdown
Contributor

@matiasperrone-exo matiasperrone-exo commented Feb 17, 2026

Task:

Ref: https://app.clickup.com/t/86b7fjj9a

Summary by CodeRabbit

  • Documentation
    • Added OpenAPI/Swagger documentation for OAuth2/OIDC: authorization endpoints (GET/form methods) with parameters, token issuance, revocation, introspection, and RP-initiated logout (GET/POST) behaviors and outcomes.
    • Added OpenID Connect discovery and JWKS documentation.
    • Added comprehensive request/response and error schema definitions plus OAuth2 security scheme descriptions.

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----web---oauth2providercontroller branch 3 times, most recently from 5bf7fad to dfb8863 Compare February 17, 2026 21:22
@matiasperrone-exo matiasperrone-exo self-assigned this Feb 17, 2026
@matiasperrone-exo matiasperrone-exo marked this pull request as ready for review February 17, 2026 21:23
@matiasperrone-exo matiasperrone-exo added the documentation Improvements or additions to documentation label Feb 17, 2026
Copy link
Copy Markdown

@martinquiroga-exo martinquiroga-exo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matiasperrone-exo please add clickup card link to this PR

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----web---oauth2providercontroller branch from dfb8863 to 1e72293 Compare March 17, 2026 19:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Adds OpenAPI PHP attribute annotations to the OAuth2/OIDC controller methods and introduces multiple OpenAPI schema and security classes for OAuth2 requests/responses, JWKS, and OpenID discovery; no runtime controller logic or public method signatures were changed.

Changes

Cohort / File(s) Summary
Controller Documentation
app/Http/Controllers/OAuth2/OAuth2ProviderController.php
Added OA attribute annotations for endpoints: /oauth2/auth (GET + form variants), /oauth2/token, /oauth2/token/revoke, /oauth2/token/introspection, /oauth2/certs, /.well-known/openid-configuration, and /oauth2/end-session (GET/POST). Documents parameters, requestBody schemas, security requirements, and response status codes.
Response Schemas
app/Swagger/OAuth2ProviderControllerSchemas.php
Added OA schema classes: OAuth2TokenResponse, OAuth2ErrorResponse, OAuth2IntrospectionResponse, JWKSResponse, and OpenIDDiscoveryResponse modeling token responses, OAuth errors, introspection, JWKS, and discovery document.
Request Schemas — Authorization / End-Session
app/Swagger/Requests/OAuth2AuthorizationRequestSchema.php, app/Swagger/Requests/OAuth2EndSessionRequestSchema.php
Added OAuth2AuthorizationRequest schema (required: response_type, client_id, redirect_uri; includes scope/state/nonce/PKCE/enums) and OAuth2EndSessionRequest schema (required: client_id; optional post_logout_redirect_uri, etc.).
Request Schemas — Token / Revocation / Introspection
app/Swagger/Requests/OAuth2TokenRequestSchema.php, app/Swagger/Requests/OAuth2TokenRevocationRequestSchema.php, app/Swagger/Requests/OAuth2TokenIntrospectionRequestSchema.php
Added OAuth2TokenRequest (required grant_type, many grant-specific fields, enums, passwordless fields), OAuth2TokenRevocationRequest (token required, token_type_hint enum), and OAuth2TokenIntrospectionRequest (token required, optional client credentials).
Security Scheme
app/Swagger/Security/OAuth2ProviderControllerSecuritySchema.php
Added OA security schemes: OAuth2ProviderSecurity (oauth2 client_credentials flow using tokenUrl constant) and OAuth2ProviderClientBasic (HTTP basic for client_id:client_secret).
Imports / Attributes
app/Http/Controllers/..., app/Swagger/...
Added OpenApi\Attributes imports and aliased Symfony Response status constants for use in OA attribute annotations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble docs by moonlight, neat and quick,
Schemas stacked like carrots, tidy and slick.
Endpoints mapped with attributes aligned,
Swagger hops through every OAuth vine.
A joyful hop — the API now twinkles ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding OpenAPI documentation to the OAuth2ProviderController web routes.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/openapi----web---oauth2providercontroller

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@matiasperrone-exo
Copy link
Copy Markdown
Contributor Author

Rebased

@github-actions
Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-113/

This page is automatically updated on each push to this PR.

Copy link
Copy Markdown

@martinquiroga-exo martinquiroga-exo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matiasperrone-exo please see comments and please sign your commits or PR will be rejected.

Also, as a final note, PUT, PATCH, and DELETE are documented for /oauth2/auth but are not part of OAuth2/OIDC, so I'm not sure if they are needed but I defer to you.

Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php
Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php
Comment thread app/Swagger/Requests/OAuth2EndSessionRequestSchema.php
Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php
Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----web---oauth2providercontroller branch from 1e72293 to db9f777 Compare April 24, 2026 14:27
@github-actions
Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-113/

This page is automatically updated on each push to this PR.

1 similar comment
@github-actions
Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-113/

This page is automatically updated on each push to this PR.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/Swagger/OAuth2ProviderControllerSchemas.php`:
- Around line 7-172: The response schemas are missing RFC-required "required"
arrays; update the OA\Schema annotations for OAuth2TokenResponseSchema to
include required: ['access_token','token_type'], for
OAuth2IntrospectionResponseSchema add required: ['active'], for
JWKSResponseSchema add required: ['keys'], and for OpenIDDiscoveryResponseSchema
add required:
['issuer','authorization_endpoint','token_endpoint','jwks_uri','response_types_supported','subject_types_supported','id_token_signing_alg_values_supported']
by adding the required key to each corresponding #[OA\Schema(...)] attribute so
the generated docs include the mandated required fields.

In `@app/Swagger/Security/OAuth2ProviderControllerSecuritySchema.php`:
- Line 14: The Swagger OAuth2 security schema is using
L5_SWAGGER_CONST_TOKEN_URL which defaults to http://localhost/oauth/token but
your actual endpoint is /oauth2/token; update the constant value or document the
required env override so the tokenUrl points to /oauth2/token (or the correct
full URL) — locate the usage in OAuth2ProviderControllerSecuritySchema.php
referencing L5_SWAGGER_CONST_TOKEN_URL and change the configuration/ENV (or the
default in the l5-swagger config) so the swagger Authorize flow targets
/oauth2/token.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 601a3165-be20-415f-abe8-e4fa29f5c8c5

📥 Commits

Reviewing files that changed from the base of the PR and between db9f777 and 9448328.

📒 Files selected for processing (8)
  • app/Http/Controllers/OAuth2/OAuth2ProviderController.php
  • app/Swagger/OAuth2ProviderControllerSchemas.php
  • app/Swagger/Requests/OAuth2AuthorizationRequestSchema.php
  • app/Swagger/Requests/OAuth2EndSessionRequestSchema.php
  • app/Swagger/Requests/OAuth2TokenIntrospectionRequestSchema.php
  • app/Swagger/Requests/OAuth2TokenRequestSchema.php
  • app/Swagger/Requests/OAuth2TokenRevocationRequestSchema.php
  • app/Swagger/Security/OAuth2ProviderControllerSecuritySchema.php

Comment thread app/Swagger/OAuth2ProviderControllerSchemas.php
Comment thread app/Swagger/Security/OAuth2ProviderControllerSecuritySchema.php
@matiasperrone-exo
Copy link
Copy Markdown
Contributor Author

@martinquiroga-exo please review again. All PR's requested changes and additional AI comments were added.

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----web---oauth2providercontroller branch from 59f315f to 03c7efc Compare April 24, 2026 20:17
@github-actions
Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-113/

This page is automatically updated on each push to this PR.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/Http/Controllers/OAuth2/OAuth2ProviderController.php`:
- Around line 431-440: The operationId value inside the OA\Get for the
'/oauth2/.well-known/openid-configuration' endpoint is garbled
("OAclient_secretuth2OpenIdDiscovery"); replace it with a proper camelCase
identifier such as "oauth2OpenIdDiscovery" in that OA\Get annotation, and also
change the sibling operationId "OpenIdDiscovery" (earlier in the file) to
"openIdDiscovery" to maintain camelCase consistency with other operationIds like
oauth2Token and oauth2RevokeToken.
- Around line 301-320: The OpenAPI security annotation is incorrect for the
token revoke/introspection/end-session endpoints: OAuth2ProviderSecurity (oauth2
clientCredentials) implies a Bearer token but the implementation
(ClientService::getCurrentClientAuthInfo) accepts HTTP Basic or
client_id/client_secret form params and end-session uses
id_token_hint/client_id; fix by adding a new HTTP Basic security scheme named
OAuth2ProviderClientBasic (type=http, scheme=basic, description per RFC 6749
§2.3.1) and update the annotations on the OAuth2ProviderController operations
for /oauth2/token/revoke and /oauth2/token/introspection to allow either the
OAuth2ProviderClientBasic or existing OAuth2ProviderSecurity (i.e., list both in
the security array), and remove the security annotation entirely from the
/oauth2/end-session operation so that authentication remains documented via
id_token_hint/client_id form/query params.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c11200a1-3918-4c70-8ae4-5eb3bc1ca968

📥 Commits

Reviewing files that changed from the base of the PR and between 9448328 and 03c7efc.

📒 Files selected for processing (4)
  • app/Http/Controllers/OAuth2/OAuth2ProviderController.php
  • app/Swagger/OAuth2ProviderControllerSchemas.php
  • app/Swagger/Requests/OAuth2AuthorizationRequestSchema.php
  • app/Swagger/Requests/OAuth2TokenIntrospectionRequestSchema.php
✅ Files skipped from review due to trivial changes (1)
  • app/Swagger/Requests/OAuth2AuthorizationRequestSchema.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/Swagger/OAuth2ProviderControllerSchemas.php

Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php
Comment thread app/Http/Controllers/OAuth2/OAuth2ProviderController.php Outdated
@matiasperrone
Copy link
Copy Markdown
Contributor

@matiasperrone-exo please see comments and please sign your commits or PR will be rejected.

Also, as a final note, PUT, PATCH, and DELETE are documented for /oauth2/auth but are not part of OAuth2/OIDC, so I'm not sure if they are needed but I defer to you.

fixed

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----web---oauth2providercontroller branch from 03c7efc to 4ce765c Compare April 24, 2026 21:18
@github-actions
Copy link
Copy Markdown

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-113/

This page is automatically updated on each push to this PR.

@matiasperrone-exo
Copy link
Copy Markdown
Contributor Author

@martinquiroga-exo please review again

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
app/Http/Controllers/OAuth2/OAuth2ProviderController.php (1)

426-426: ⚠️ Potential issue | 🟡 Minor

Stale "Also available at …" sentence still present in description.

A previous review asked to remove Also available at /oauth2/.well-known/openid-configuration. from this description to avoid inconsistency, and the reply was "done" — but the sentence is still here.

✏️ Proposed fix
-        description: 'Returns the OpenID Provider Configuration document per OpenID Connect Discovery 1.0. Also available at /oauth2/.well-known/openid-configuration.',
+        description: 'Returns the OpenID Provider Configuration document per OpenID Connect Discovery 1.0.',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/Http/Controllers/OAuth2/OAuth2ProviderController.php` at line 426, The
description string inside OAuth2ProviderController (the OpenID Provider
Configuration response) still contains the stale sentence "Also available at
/oauth2/.well-known/openid-configuration."; locate the description assignment or
array entry (the string shown in the diff) in OAuth2ProviderController.php and
remove that trailing sentence so the description reads only "Returns the OpenID
Provider Configuration document per OpenID Connect Discovery 1.0." (ensure
punctuation remains correct).
🧹 Nitpick comments (1)
app/Http/Controllers/OAuth2/OAuth2ProviderController.php (1)

258-258: Consider allowing OAuth2ProviderClientBasic on /oauth2/token for consistency.

The sibling /oauth2/token/revoke (line 308) and /oauth2/token/introspection (line 358) endpoints list both OAuth2ProviderClientBasic and OAuth2ProviderSecurity, but /oauth2/token lists only OAuth2ProviderSecurity. The token endpoint accepts HTTP Basic client authentication per RFC 6749 §2.3.1 as well, so Swagger UI should surface that option here too.

🔧 Suggested alignment
-        security: [['OAuth2ProviderSecurity' => []]],
+        security: [['OAuth2ProviderClientBasic' => []], ['OAuth2ProviderSecurity' => []]],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/Http/Controllers/OAuth2/OAuth2ProviderController.php` at line 258, The
OpenAPI security entry for the /oauth2/token operation currently lists only
'OAuth2ProviderSecurity'; update the operation's security array to also include
'OAuth2ProviderClientBasic' so the token endpoint surfaces HTTP Basic client
auth like the sibling endpoints (/oauth2/token/revoke and
/oauth2/token/introspection). Locate the security declaration for the
/oauth2/token operation in OAuth2ProviderController (the entry with security:
[['OAuth2ProviderSecurity' => []]]) and add an additional element for
'OAuth2ProviderClientBasic' to the array.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@app/Http/Controllers/OAuth2/OAuth2ProviderController.php`:
- Line 426: The description string inside OAuth2ProviderController (the OpenID
Provider Configuration response) still contains the stale sentence "Also
available at /oauth2/.well-known/openid-configuration."; locate the description
assignment or array entry (the string shown in the diff) in
OAuth2ProviderController.php and remove that trailing sentence so the
description reads only "Returns the OpenID Provider Configuration document per
OpenID Connect Discovery 1.0." (ensure punctuation remains correct).

---

Nitpick comments:
In `@app/Http/Controllers/OAuth2/OAuth2ProviderController.php`:
- Line 258: The OpenAPI security entry for the /oauth2/token operation currently
lists only 'OAuth2ProviderSecurity'; update the operation's security array to
also include 'OAuth2ProviderClientBasic' so the token endpoint surfaces HTTP
Basic client auth like the sibling endpoints (/oauth2/token/revoke and
/oauth2/token/introspection). Locate the security declaration for the
/oauth2/token operation in OAuth2ProviderController (the entry with security:
[['OAuth2ProviderSecurity' => []]]) and add an additional element for
'OAuth2ProviderClientBasic' to the array.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9443d97-061c-43d3-8ad1-f82dd57c2e97

📥 Commits

Reviewing files that changed from the base of the PR and between 03c7efc and 4ce765c.

📒 Files selected for processing (2)
  • app/Http/Controllers/OAuth2/OAuth2ProviderController.php
  • app/Swagger/Security/OAuth2ProviderControllerSecuritySchema.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants